#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //此处直接针对widget对象使用geometry和frameGeometry,观察区别
//    QRect rect1 = this->geometry();
//    QRect rect2 = this->frameGeometry();
//    qDebug() << rect1;
//    qDebug() << rect2;

    //创建一个按钮
    QPushButton* button = new QPushButton(this);
    button->setText("按钮");
    button->move(100,100);

    //建立信号槽
    connect(button,&QPushButton::clicked,this,&Widget::handle);
}

Widget::~Widget()
{
    delete ui;
}

//槽函数的定义
void Widget::handle()
{
        QRect rect1 = this->geometry();
        QRect rect2 = this->frameGeometry();
        qDebug() << rect1;
        qDebug() << rect2;
}

